﻿package {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import com.media.controllers.SWFController;
	import com.media.displays.SWFDisplay;
	import com.events.MediaEvent;
	
	public class SWFTest extends Sprite {
		private var _swfController:SWFController;
		private var _swfDisplay:SWFDisplay;
		public function SWFTest() {
			init();
		}
		private function init():void {
			_swfController=new SWFController  ;
			_swfController.addEventListener(Event.INIT,mediaInit,false,0,true);
			_swfController.addEventListener(MediaEvent.COMPLETE,mediaComplete,false,0,true);
			_swfDisplay=new SWFDisplay  ;
			addChild(_swfDisplay);
			_swfDisplay.x=115;
			_swfDisplay.y=80;
			_swfDisplay.displayWidth=320;
			_swfDisplay.displayHeight=240;
			_swfDisplay.setController(_swfController);
			_swfController.loadMedia("bookworm.swf");
			stage.addEventListener(MouseEvent.MOUSE_DOWN,mouseDown,false,0,true);
		}
		private function mediaInit(pEvent:Event):void {
			trace("SWF init");
		}
		private function mediaComplete(pEvent:MediaEvent):void {
			trace("SWF complete");
		}
		private function mouseDown(pEvent:MouseEvent):void {
			_swfController.pauseMedia(! _swfController.paused);
		}
	}
}